<section class="content-header">
  <h1>
    项目管理
    <small>项目相关操作</small>
  </h1>
  <ol class="breadcrumb">
    <li><a href="#/index"><i class="fa fa-dashboard"></i> 主页</a></li>
    <li class="active">项目列表</li>
  </ol>
</section>
<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box">
        <div class="box-header">
          <h3 class="box-title">项目列表</h3>
          <hr>
          <div class="row">
            <div class="col-xs col-md-6">
              <div class="col-xs col-sm-4">
                <button privilege="添加项目" class="btn btn-primary" ng-click="addProject();">
                  <span>添加项目</span>
                </button>
              </div>
            </div>
            <div class="col-xs col-md-6">
              <div class="col-xs col-sm-4"></div>
              <div class="col-xs col-sm-6">
                <i class="fa fa-search"></i> <input type="text"
                                                    ng-change="changeCD();" ng-model="condition"
                                                    placeholder="名称/日期/状态等搜索">
              </div>
            </div>
          </div>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <table id="example2" class="table table-bordered table-hover">
            <thead>
            <tr>
              <th ng-show="status">
                <div class="btn-group">
                  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"
                          aria-expanded="false">状态
                    <span class="fa fa-caret-down"></span></button>
                  <ul class="dropdown-menu" role="menu">
                    <li>
                      <button href class="btn btn-primary btn-sm"
                              ng-click="changeState(-1);">所有
                      </button>
                    </li>
                    <li ng-repeat="state in states">
                      <button ng-class="state.style"
                              ng-click="changeState(state.sid);">{{state.sname}}
                      </button>
                    </li>
                  </ul>
                </div>
              </th>
              <th ng-hide="status">状态</th>
              <th>项目名称</th>
              <th>投标时间</th>
              <th>开始时间</th>
              <th>结束时间</th>
              <th>项目单位</th>
              <th ng-show="opt">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="project in page.recordList" style="cursor: pointer"
                ng-click="projectInfo($index);" privilege="查看项目:projectInfo">
              <td ng-show="status">
                <div class="btn-group">
                  <a ng-class="project.style" ng-click="toggle($event);"
                     class=" btn-xs dropdown-toggle"  data-toggle="dropdown"
                     aria-expanded="false">{{project.stateName}} <span
                    class="fa fa-caret-down"></span>
                  </a>
                  <ul class="dropdown-menu" role="menu">
                    <li ng-repeat="state in states">
                      <button ng-class="state.style" class="btn-xs"
                              ng-click="edit(project.pid,state.sid,$event);">{{state.sname}}
                      </button>
                    </li>
                  </ul>
                </div>
              </td>
              <td ng-hide="status" ng-bind-html="project.stateName|highlightText:condition"></td>
              <td ng-bind-html="project.pname|highlightText:condition"></td>
              <td ng-bind-html="project.biddingtime|highlightText:condition"></td>
              <td ng-bind-html="project.begintime|highlightText:condition"></td>
              <td ng-bind-html="project.endtime|highlightText:condition"></td>
              <td ng-bind-html="project.companyName|highlightText:condition"></td>
              <td>
                <button privilege="删除项目" ng-click="del(project.pid,$event)" class="btn-xs btn-danger">
                  <span>删除</span>
                </button>
              </td>
            </tr>
            </tbody>
          </table>
          <div ui-view="pagebar"></div>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
  </div>
</section>
<div class="modal fade" role="dialog" id="project"
     aria-labelledby="title">
  <form name="myForm" novalidate id="form">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" ng-click="cancel();"
                  aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
          <h4 class="modal-title">添加项目</h4>
        </div>
        <div class="modal-body">
          <div class="container-fluid">
            <div class="row">
              <div class="col-xs col-md-6">
                <div class="input-group">
										<span class="input-group-addon">
                                            <i class="fa fa-database"></i>
                                        </span>
                  <input ng-model="project.pname"
                         type="text" name="pname"
                         class="form-control"
                         aria-describedby="sizing-addon1"
                         placeholder="项目名称" required>
                </div>
                                <span style="color:red"
                                      ng-show="myForm.pname.$dirty && myForm.pname.$invalid">
                                    <span ng-show="myForm.pname.$error.required">项目名称必须填写。</span>
                                </span>
              </div>
              <div class="col-xs col-md-6">
                <div class="input-group">
                                     <span class="input-group-addon">
                                            <i class="glyphicon glyphicon-calendar"></i>
                                        </span>
                  <input ng-model="project.biddingtime1"
                         type="date"
                         name="biddingtime"
                         class="form-control"
                         aria-describedby="sizing-addon1"
                         placeholder="投标时间"
                         required>
                </div>
              </div>
            </div>
            <br/>
            <div class="row">
              <div class="col-xs col-md-6">
                <div class="input-group">
                                   <span class="input-group-addon">
                                            <i class="glyphicon glyphicon-calendar"></i>
                                        </span>
                  <input ng-model="project.begintime1"
                         type="date"
                         name="begintime"
                         ng-min="project.biddingtime1"
                         class="form-control"
                         aria-describedby="sizing-addon1"
                         placeholder="开始时间"
                         required>
                                    <span class="error"
                                          ng-show="myForm.begintime.$dirty && myForm.begintime.$invalid">
                                    <span ng-show="myForm.begintime.$error.min">开始时间不能在投标时间之前</span>
                                </span>
                </div>
              </div>
              <div class="col-xs col-md-6">
                <div class="input-group">
										<span class="input-group-addon">
                                            <i class="glyphicon glyphicon-calendar"></i>
                                        </span>
                  <input ng-model="project.endtime1"
                         type="date" name="endtime"
                         ng-min="project.begintime1"
                         class="form-control"
                         aria-describedby="sizing-addon1"
                         placeholder="结束时间" required>
                                    <span style="color:red"
                                          ng-show="myForm.endtime.$dirty && myForm.endtime.$invalid">
                                    <span ng-show="myForm.endtime.$error.min">结束时间不能在开始时间之前</span>
                                </span>
                </div>
              </div>
            </div>
            <br/>
            <div class="row">
              <div class="col-xs col-md-6">
                <div class="input-group">
										<span class="input-group-addon"><i
                      class="glyphicon glyphicon-globe"></i> </span> <select
                  name="pstate" required ng-model="project.pstate"
                  class="form-control select2" style="width: 100%;">
                  <option value="" disabled>状态</option>
                  <option ng-repeat="state in states"
                          value="{{state.sid}}">{{state.sname}}
                  </option>
                </select>
                </div>
              </div>
              <div class="col-xs col-md-6">
                <div class="input-group">
										<span class="input-group-addon" id="sizing-addon2"><i
                      class="fa  fa-building "></i> </span> <select name="company" required
                                                                    ng-model="project.company"
                                                                    class="form-control select2"
                                                                    style="width: 100%;">
                  <option value="" disabled>公司</option>
                  <option ng-repeat="company in companies"
                          value="{{company.cid}}">{{company.cname}}
                  </option>
                </select>
                </div>
              </div>
            </div>
            <br/>
            <hr/>
            <div class="row">
              <div class="box">
                <div class="box-header">
                  <h3 class="box-title">
                    详情
                    <small>关于项目的一些要求和细节问题</small>
                  </h3>
                  <!-- tools box -->
                  <div class="pull-right box-tools">
                    <button type="button" class="btn btn-default btn-sm"
                            data-widget="collapse" data-toggle="tooltip"
                            title="隐藏">
                      <i class="fa fa-minus"></i>
                    </button>
                  </div>
                  <!-- /. tools -->
                </div>
                <!-- /.box-header -->
                <div class="box-body pad">
											<textarea class="textarea" id="textarea"
                                placeholder="留下点什么吧。。。"
                                style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default"
                    ng-click="cancel();">取消
            </button>
            <button type="button" class="btn btn-primary" ng-click="save();"
                    ng-disabled="!myForm.$valid">
              保存
            </button>
          </div>
        </div>
        <!-- /.modal-content -->
      </div>
      <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
  </form>
</div>
<div class="modal fade" id="projectInfo">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span></button>
        <h4 class="modal-title">项目详情</h4>
      </div>
      <div class="modal-body">
        <div class="box box-primary">
          <div class="box-header with-border">
            <h3 class="box-title">基本信息</h3>
          </div>
          <!-- /.box-header -->
          <div class="box-body">
            <div class="row">
              <div class="col-xs col-sm-6">
                <strong><i class="fa fa-map-marker margin-r-5"></i> 项目名称</strong>
                <p class="text-aqua ">{{pjtInfo.pname}}</p>
              </div>
              <div class="col-xs col-sm-6">
                <strong><i class="fa fa-book margin-r-5"></i> 项目单位</strong>
                <p class="text-red">{{pjtInfo.companyName}}</p>
              </div>
            </div>
          </div>
        </div>
        <small>

          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">项目状态</h3>
            </div>
            <div class="box-body">
              <ul class="timeline timeline-inverse">
                <li class="time-label">
                                    <span ng-class="{true: 'bg-green', false: 'bg-gray'}[pjtInfo.end]">
                                        {{pjtInfo.endtime}}
                                    </span>
                </li>
                <li>
                  <i class="fa  fa-check "
                     ng-class="{true: 'bg-green disabled', false: 'bg-gray'}[pjtInfo.end]"></i>
                  <div class="timeline-item">
                    <h3 class="timeline-header"><a href>{{pjtInfo.companyName}}</a> 成功的完成了该项目
                    </h3>
                  </div>
                </li>
                <li class="time-label">
                                        <span ng-class="{true: 'bg-yellow', false: 'bg-gray'}[pjtInfo.begin]">
                                          {{pjtInfo.begintime}}
                                        </span>
                </li>
                <li>
                  <i class="fa  fa-hourglass-start"
                     ng-class="{true: 'bg-yellow disabled', false: 'bg-gray'}[pjtInfo.begin]"></i>
                  <div class="timeline-item">
                    <h3 class="timeline-header">项目<span class="text-red"><strong>{{pjtInfo.pname}}</strong></span>
                      正式启动
                    </h3>
                  </div>
                </li>
                <li class="time-label">
                                    <span ng-class="{true: 'bg-aqua', false: 'bg-gray'}[pjtInfo.bidding]">
                                      {{pjtInfo.biddingtime}}
                                    </span>
                </li>
                <li>
                  <i class="fa fa-bullhorn "
                     ng-class="{true: 'bg-aqua disabled', false: 'bg-gray'}[pjtInfo.bidding]"></i>
                  <div class="timeline-item">
                    <h3 class="timeline-header"><a href>{{pjtInfo.companyName}}</a>
                      投得了项目 <span class="text-red"><strong>{{pjtInfo.pname}}</strong></span>
                    </h3>
                  </div>
                </li>
                <li class="time-label">
                                    <span class="bg-purple">
                                      {{pjtInfo.preparationdate}}
                                    </span>
                </li>
                <li>
                  <i class="fa fa-comments bg-purple disabled"></i>
                  <div class="timeline-item">
                    <h3 class="timeline-header">项目<span
                      class="text-red"><strong>{{pjtInfo.pname}}</strong></span> 进入准备工作
                    </h3>
                  </div>
                </li>
                <li>
                  <i class="fa fa-clock-o bg-gray"></i>
                </li>
              </ul>
            </div>
          </div>
        </small>
        <div class="box box-primary">
          <div class="box-header with-border">
            <h3 class="box-title">相关说明</h3>
          </div>
          <!-- /.box-header -->
          <div class="box-body">
            <strong><i class="fa fa-file-text-o margin-r-5"></i> 详情</strong>
            <p class="text-muted" ng-bind-html="pjtInfo.detail"></p>
          </div>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
  </div>
  <!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
